package com.gitee.fsmxm.thinking.in.spring.dependency.injection;

import org.springframework.beans.factory.support.BeanDefinitionReader;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * xml 配置 Setter 方法依赖注入 demo
 */
public class XmlDependencySetterInjectionDemo {


    public static void main(String[] args) {

        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();

        BeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);

        beanDefinitionReader.loadBeanDefinitions("classpath:/META-INF/dependency-setter-injection-context.xml");

        Object userHolder = beanFactory.getBean("userHolder");
        System.out.println(userHolder);

    }

}
